<template>
  <div>
    <div>应收明细</div>
    <FilterTable
      ref="table1"
      :height="300"
      :columns="columns"
      :dataSource="rowData"
      :isColumnFilter="false"
      :isToperInfo="false"
      :isSelectColumn="false"
      :onColumnsChange="columns => (this.columns = columns)"
    >
    </FilterTable>
    <div class="title">实收明细</div>
    <FilterTable ref="table1" :columns="columns1" :dataSource="list" :isColumnFilter="false" :isToperInfo="false" :isSelectColumn="false" :onColumnsChange="columns => (this.columns1 = columns)">
    </FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button @click="closeDialog">返 回</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { geJemxList } from '@/api/repair/business/customer/additional';

export default {
  name: 'priceInfoDetailTable',
  mixins: [dictionary],
  props: {
    type: {
      type: String,
      default: 'add'
    }
  },
  data() {
    this.saveData = null;
    return {
      columns: this.createTableColumns(),
      list: [],
      columns1: this.createTableColumns(),
      rowData: []
    };
  },
  created() {
    // if (this.type === 'edit') {
    //   this.formList.forEach(x => {
    //     x.initialValue = this.rowData[x.fieldName];
    //   });
    // }
  },
  mounted() {
    console.log('rowData', this.rowData);
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '收费类别',
          dataIndex: 'MANAGE_SORT_CODE',
          minWidth: 100,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '工时费',
          dataIndex: 'LABOUR_AMOUNT',
          minWidth: 100,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '维修材料费',
          dataIndex: 'REPAIR_PART_AMOUNT',
          minWidth: 120,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '销售材料费',
          dataIndex: 'SALES_PART_AMOUNT',
          minWidth: 120,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '附加费',
          dataIndex: 'ADD_ITEM_AMOUNT',
          minWidth: 110,
          sorter: true,
          showOverflowTooltip: true
        }
      ];
    },
    dosearch() {},
    addData() {},
    openModel(data) {
      this.rowData = data;
      console.log('rowData', data);
    },
    closeDialog() {
      this.$emit('close');
    }
  }
};
</script>

<style lang="less" scoped>
.title {
  margin-top: 10px;
}
</style>
